package com.mogu.blogs.service.impl;

import com.mogu.blogs.mapper.BlogContentMapper;
import com.mogu.blogs.service.BlogContentService;
import com.mogu.entity.TBlog;
import com.mogu.entity.TBlogSort;
import com.mogu.entity.TTag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import sun.util.PreHashedMap;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author muxiaofeng
 * @Date 2020/6/10 19:26.
 */
@Service
public class BlogContentServiceImpl implements BlogContentService {

    @Autowired
    BlogContentMapper blogContentMapper;

    /**
     * 通过uid查询博客内容
     * @param uid
     * @return
     */
    @Override
    public TBlog getBlogByUid(String uid) {
        return blogContentMapper.getBlogByUid(uid);
    }

    /**
     * 通过uid查询博客标签
     * @param uid
     * @return
     */
    @Override
    public TTag getBlogContentByUid(String uid) {
        return blogContentMapper.getBlogContentByUid(uid);
    }

    /**
     * 通过uid查询点赞数
     * @param uid
     * @return
     */
    @Override
    public TBlog getBlogPraiseCountByUid(String uid) {
        return blogContentMapper.getBlogPraiseCountByUid(uid);
    }

    /**
     * 通过uid给博客点赞
     * @param uid
     * @return
     */
    @Override
    public void praiseBlogByUid(String uid) {
        blogContentMapper.praiseBlogByUid(uid);
    }

    /**
     * 通过标签的uid查询相关博客
     * @return
     */
    @Override
    public List<TBlog> getTagContentByUid(String uid) {
        return blogContentMapper.getTagContentByUid(uid);
    }

    /**
     * 通过uid查询分类名
     * @param uid
     * @return
     */
    @Override
    public TBlogSort getBlogSortContentByUid(String uid) {
        return blogContentMapper.getBlogSortContentByUid(uid);
    }

    /**
     * 通过分类的uid查询相关博客
     * @param uid
     * @return
     */
    @Override
    public List<TBlog> getSortContentByUid(String uid) {
        return blogContentMapper.getSortContentByUid(uid);
    }

    /**
     * 查询相关文章标题
     * @return
     */
    @Override
    public List<TBlog> getBlogTitle() {
        return blogContentMapper.getBlogTitle();
    }

    /**
     * 通过标题名查询相关博客
     * @param title
     * @return
     */
    @Override
    public List<TBlog> getBlogByBlogTitle(String title) {
        return blogContentMapper.getBlogByBlogTitle(title);
    }

    /**
     * 通过作者查询相关博客
     * @param author
     * @return
     */
    @Override
    public List<TBlog> getBlogByBlogAuthor(String author) {
        return blogContentMapper.getBlogByBlogAuthor(author);
    }

    /**
     * 通过分类名查询相关博客
     * @param sortName
     * @return
     */
    @Override
    public List<TBlog> getBlogBySortName(String sortName) {
        return blogContentMapper.getBlogBySortName(sortName);
    }

    /**
     * 通过标签内容查询相关博客
     * @param content
     * @return
     */
    @Override
    public List<TBlog> getBlogByTagContent(String content) {
        return blogContentMapper.getBlogByTagContent(content);
    }
}
